﻿<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <div style="margin-top:40px;">
        <div id="leftSideBar" style="min-width: 500px; max-width: 500px; float: left ">

        </div>
        <div id="rightSideBar" style="overflow-x:scroll;float: right;padding-left:10px">
            <table cellpadding="0" cellspacing="0" id="fr_body">

        <tr>
            <td ng-repeat="p in q" valign="top">
                <table style="width: 600px; min-width: 600px; float: left; margin: 0px; padding: 0px" cellpadding="0" cellspacing="0">

                    <tr>
                        <td>
                            <span class="font-size-30" style="text-transform:uppercase" ng-click="showDetail(p);">
                                {{getGroupFormCaption(p)}}

                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 40px; min-height: 40px; color: #000">&nbsp;</td>
                    </tr>
                    <tr>
                        <td valign="top">


                            <div ng-repeat="x in getGroupItems(p)" ng-if="getGroupItems(p).indexOf(x)<9" style="margin-right:20px;margin-bottom:20px;color:#000" class="block-size-150 hugpage-block-item" ng-class="[$$$blockClass()]">

                                <table style="float:left;width:100%;cursor:pointer" cellpadding="0" cellspacing="0" ng-click="loadPage(x)">
                                    <tr>
                                        <td style="min-height:100px">&nbsp;</td>
                                    </tr>

                                    <tr>

                                        <td style="padding:4px" ng-class="[$$$captionClass()]">
                                            {{getFormCaption(x)}}
                                        </td>
                                    </tr>
                                </table>

                            </div>

                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

        </div>
        
    </div>
    <script>

        var scope = this;
        scope.$$$blockClass = function () {
            return window.$navigator.module.BlockClass;
        };
        scope.getFormCaption = function (x) {
            var mIndex = window.$navigator.menu.indexOf(window.$navigator.module);
            return scope.$$$res("AppMenu.Item." + mIndex + "." + window.$navigator.module.children.item.indexOf(x) + "." + x.caption, x.caption, "FormName", "hubpage/hubpage.html")
        }
        scope.$$$captionClass = function () {
            return window.$navigator.module.caption_class;
        };
        scope.getGroupFormCaption = function (p) {
            var mIndex = window.$navigator.menu.indexOf(window.$navigator.module);
            return scope.$$$res("AppMenu.Group." + scope.Captions["C_" + scope.q.indexOf(p)], scope.Captions["C_" + scope.q.indexOf(p)], "FormName.Group", "hubpage/hubpage.html");
        }
        scope.getGroupItems = function (p) {
            var ret = scope.groups['C_' + scope.q.indexOf(p)];
            return ret;
        }
        scope.$$$ready(function () {
            scope.$find("#leftSideBar").css("max-height", $(window).height() - 160);
            scope.$find("#leftSideBar").css("min-height", $(window).height() - 160);
            scope.$find("#rightSideBar").css("max-height", $(window).height() - 160);
            scope.$find("#rightSideBar").css("min-height", $(window).height() - 160);
            scope.$find("#leftSideBar-body").css("min-height", $(window).height() - 320);
            scope.$find("#leftSideBar-body").css("max-height", $(window).height() - 320);
            scope.$find("#rightSideBar").css("max-width", $(window).width() - 160 - 500 - 40);
            scope.$find("#rightSideBar").css("min-width", $(window).width() - 160 - 500 - 40);
            scope.q = [];
            scope.Captions = {};
            scope.groups = _.groupBy(window.$navigator.module.children.item, function (o) {
                var i = scope.q.indexOf(o.group);
                if (i == -1) {
                    i = scope.q.length;
                    scope.q.push(o.group);
                    scope.Captions["C_" + i] = o.group;
                }

                return "C_" + i;
            });
            scope.$apply();
        });


        scope.loadPage = function (x, nonHistory) {
            scope.$root.$appView.loadView(x.page, function (subScope) {
                if (!subScope.$$$caption) {
                    var menu = window.$navigator.menu;
                    var p = window.$navigator.module;
                    subScope.$$$caption = subScope.$$$res("AppMenu.Item." + menu.indexOf(p) + "." + p.children.item.indexOf(x) + "." + x.caption, x.caption, "FormName", "hubpage/hubpage.html")

                }
                subScope.$root.$session_header.$setCaption(subScope.$$$caption);
                subScope.$root.$header.$hide();
                subScope.$root.$session_header.$show();
            });


        }
       
    </script>

</body>
</html>